package com.aspose.cells;

public class Area {
   private Chart b;
   Object a;
   private boolean c = false;
   private FillFormat d;

   Area(Chart chart, Object parent) {
      this.b = chart;
      this.a = parent;
   }

   boolean a() {
      return this.d != null && (this.d.getType() == 5 || this.d.getType() == 4 || this.d.getType() == 3);
   }

   void b() {
      if (this.a != null) {
         if (this.a instanceof zor) {
            ((zor)this.a).a((Object)null);
         } else if (this.a instanceof ChartFrame) {
            ((ChartFrame)this.a).a((Object)null);
         }
      }

   }

   void c() {
      this.b();
   }

   public Color getBackgroundColor() {
      if (this.getFillFormat().getType() == 5) {
         return this.getFillFormat().getPatternFill().getBackgroundColor();
      } else {
         return this.getFillFormat().getType() == 2 ? this.getFillFormat().getSolidFill().a() : Color.getEmpty();
      }
   }

   public void setBackgroundColor(Color value) {
      this.setFormatting(2);
      if (this.getFillFormat().getType() == 5) {
         this.getFillFormat().getPatternFill().setBackgroundColor(value);
      } else if (this.getFillFormat().getType() == 2) {
         this.getFillFormat().getSolidFill().a(value);
      }

      this.b();
   }

   public Color getForegroundColor() {
      if (this.getFillFormat().getType() == 2) {
         return this.getFillFormat().getSolidFill().getColor();
      } else {
         return this.getFillFormat().getType() == 5 ? this.getFillFormat().getPatternFill().getForegroundColor() : Color.getEmpty();
      }
   }

   public void setForegroundColor(Color value) {
      this.setFormatting(2);
      if (this.getFillFormat().getType() == 2) {
         this.getFillFormat().getSolidFill().setColor(value);
      } else if (this.getFillFormat().getType() == 5) {
         this.getFillFormat().getPatternFill().setForegroundColor(value);
      }

      this.b();
   }

   public int getFormatting() {
      if (this.getFillFormat().getType() == 0) {
         return 0;
      } else {
         return this.getFillFormat().getType() == 1 ? 1 : 2;
      }
   }

   public void setFormatting(int value) {
      if (value == 0) {
         this.getFillFormat().setType(0);
      } else if (value == 1) {
         this.getFillFormat().setType(1);
      } else if (value == 2 && (this.getFillFormat().getType() == 0 || this.getFillFormat().getType() == 1)) {
         this.getFillFormat().setType(2);
      }

      this.b();
   }

   public boolean getInvertIfNegative() {
      return this.c;
   }

   public void setInvertIfNegative(boolean value) {
      this.c = value;
   }

   public FillFormat getFillFormat() {
      if (this.d == null) {
         this.d = new FillFormat(this, this.b.j().n());
      }

      this.b();
      return this.d;
   }

   int d() {
      byte var1 = 100;
      return this.d != null ? this.d.a() : var1;
   }

   public double getTransparency() {
      return com.aspose.cells.b.a.zq.b((double)(100 - this.d()) / 100.0D, 2);
   }

   public void setTransparency(double value) {
      if (value >= 0.0D && value <= 1.0D) {
         if (this.d != null) {
            this.d.setTransparency(value);
         }

      } else {
         throw new CellsException(6, "Transparency must between 0.0 (opaque) and 1.0 (clear)");
      }
   }

   FillFormat e() {
      return this.d;
   }

   void a(Area var1, CopyOptions var2) {
      this.c = var1.c;
      if (var1.d != null) {
         this.d = new FillFormat(this, this.b.j().n());
         this.d.a(var1.d, var2);
      } else {
         this.d = null;
      }

   }

   boolean a(Area var1, zma var2) {
      if (this.c != var1.c) {
         return false;
      } else {
         if (this.d != null || var1.d != null) {
            if (this.d == null || var1.d == null) {
               return false;
            }

            if (!this.d.a(var1.d, var2)) {
               return false;
            }
         }

         return true;
      }
   }

   /** @deprecated */
   public boolean isAuto() {
      return this.getFormatting() == 0;
   }

   /** @deprecated */
   public boolean isVisible() {
      return this.getFormatting() != 1;
   }

   /** @deprecated */
   public void setAuto(boolean isAuto) {
      if (isAuto) {
         this.setFormatting(0);
      }

   }
}
